package com.dhcy.mqtt.controller;


import com.dhcy.mqtt.par.ht.EquipmentDataPar;
import com.dhcy.mqtt.par.ht.OnlineDataPar;
import com.dhcy.mqtt.par.ht.PagePar;
import com.dhcy.mqtt.result.ht.TableResultData;
import com.dhcy.mqtt.service.OnlineDataService;
import com.dhcy.mqtt.util.AppResultData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/onlineData")
public class OnlineDataController {

    @Autowired
    private OnlineDataService onlineDataService;

    @GetMapping
    public TableResultData list(OnlineDataPar pagePar){
        return onlineDataService.list(pagePar);
    }


    @GetMapping("brokenLine")
    public AppResultData brokenLine(Integer num,String number){
        return onlineDataService.brokenLine(num,number);
    }

    @PostMapping("add")
    public AppResultData add(@RequestBody EquipmentDataPar equipmentDataPar){
        onlineDataService.addData(equipmentDataPar);
        return AppResultData.successData("成功");
    }


}
